#!/usr/bin/python2.4
#
# Copyright 2007 Google Inc. All Rights Reserved.

from AbstractExtractor import *
import Image
from tools.writer import *


class testExtractor(AbstractExtractor):
  def __init__(self, image_path):
    	self.image_path = image_path
	self.writer = CommentWriter.CommentWriter()

  def run(self):
	im = Image.open(self.image_path)
	self.width, self.height = im.size
	self.format = im.format

  def resultshort(self):
	return 'Format = %s' % self.format

  def resultlong(self):
        self.writer.addFunction('size')
        self.writer.addProperty('width', self.width)
        self.writer.addProperty('height', self.height)
        return self.writer.writeXML()

